package main

import (
	"flag"
	"go_stu_gin/config"
	"go_stu_gin/server"
	"log"
)

func main() {
	env, host, port := "", "", ""
	flag.StringVar(&env, "env", "dev", "填写-env dev 或者 -env pro")
	flag.StringVar(&host, "H", "127.0.0.1", "ip号")
	flag.StringVar(&port, "P", "8080", "端口号")
	flag.Parse()
	// 初始化配置
	// 默认为开发环境
	path := "./config/yaml/conf_dev.yaml"
	if env == "pro" {
		path = "./config/yaml/conf_pro.yaml"
	}
	if err := config.Config(path); err != nil {
		log.Fatalf("err: %s\n", err)
	}
	server.Run(host, port)
}
